package com.etc.wordcount;


import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.topology.TopologyBuilder;
import org.apache.storm.tuple.Fields;

/**
 * @author 上等的猪头肉
 * @Title: WCDemo
 * @ProjectName storm
 * @Description: TODO
 * @date 2018/11/15 16:03
 */
public class WCDemo {
    public static void main(String[] args) {
        TopologyBuilder builder = new TopologyBuilder();

        builder.setSpout("wcspout", new WCSpout());
        builder.setBolt("splitbolt", new SplitBolt()).shuffleGrouping("wcspout");
        builder.setBolt("countbolt", new CountBolt()).fieldsGrouping("splitbolt", new Fields("word"));

        LocalCluster localCluster = new LocalCluster();
        localCluster.submitTopology("wc", new Config(), builder.createTopology());
    }
}
